#!/bin/bash
id=1

for (( i = 0; i < 10; i++ )); do
	    COORD_X=$(awk -v min=-180 -v max=180 'BEGIN{srand(); print min+rand()*(max-min)}')  # 随机坐标的x
    COORD_Y=$(awk -v min=-90 -v max=90 'BEGIN{srand(); print min+rand()*(max-min)}')  # 随机坐标的y
    DIRECTION=("东" "南" "西" "北")  # 运动方向
    VEHICLE_ID="车辆编号$(shuf -i 1-10 -n 1)"  # 车辆编号随机生成
    MESSAGE="{\"coordinate\":\"POINT($COORD_X $COORD_Y)\",\"direction\":\"${DIRECTION[$(($RANDOM%4))]}\",\"id\":$((id++)),\"road\":\"经十路\",\"time\":$(($(date +%s%N)/1000000)),\"vehicleId\":\"$VEHICLE_ID\"}"
    echo "$MESSAGE"
done